<?php 
// Dojo読み出し
$head->register_js("javascript-xpath-latest-cmp");
?>

<script>
dojo.require("dojo.io");
dojo.require("dojo.io.XhrIframeProxy");
 
dojo.io.bind({
    iframeProxyUrl: "http://some.domain.com/path/to/xip_server.html",
    url: "http:/some.domain.com/path/to/api",
    mimetype: "text/plain"
    load: function(type, data, evt, kwArgs){
        /* do stuff with the result here */
    }
});

function loadText(filename){
    filename = "http://www.ajaxtower.jp/sample/" + filename;

    dojo.io.bind({
        url: filename,
        handle: displayData,
        
    });
}

function displayData(type, data, evt){
    if (type == "load"){
        alert(type + " : " + data);
    }else if (type == "error"){
        alert(type + " : " + data.message);
    }
}

</script>
<form>
<input type="button" value="ファイル読み込み" onClick="loadText('readfile.txt')">
<input type="button" value="ファイル読み込み(エラー)" onClick="loadText('readfile.txt2')">
</form>